package ca.jsbr.as2js_lib.utils.generic 
{
	import ca.jsbr.as2js_lib.utils.geom.Rect;
	import js.element.HTMLElement;
	/**
	 * ...
	 * @author jsbr [me@jsbr.ca]
	 */
	public class TagUtils 
	{
		
		public function TagUtils() 
		{
			
		}
		
		static public function getCoord(element:HTMLElement):Rect {
			var orig:HTMLElement = element;
			var left:Number = 0;
			var top:Number = 0;
			if(element.offsetParent){
					left += element.offsetLeft;
					top += element.offsetTop;
					while (element = element.offsetParent) {
							left += (element.offsetLeft-element.scrollLeft+element.clientLeft);
							top += (element.offsetTop-element.scrollTop+element.clientTop);
					}
			}
			
			return new Rect(left,top,orig.offsetWidth,orig.offsetHeight);
		}
		
	}

}